Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Piecewise linear function</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Piecewise_linear_function"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.math.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Piecewise_linear_function rootpage-Piecewise_linear_function skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Piecewise linear function</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1305433154">
/* start https://en.wikipedia.org/ */


.mw-parser-output .ambox{border:1px solid #a2a9b1;border-left:10px solid #36c;background-color:#fbfbfb;box-sizing:border-box}.mw-parser-output .ambox+link+.ambox,.mw-parser-output .ambox+link+style+.ambox,.mw-parser-output .ambox+link+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+style+.ambox,.mw-parser-output .ambox+.mw-empty-elt+link+link+.ambox{margin-top:-1px}html body.mediawiki .mw-parser-output .ambox.mbox-small-left{margin:4px 1em 4px 0;overflow:hidden;width:238px;border-collapse:collapse;font-size:88%;line-height:1.25em}.mw-parser-output .ambox-speedy{border-left:10px solid #b32424;background-color:#fee7e6}.mw-parser-output .ambox-delete{border-left:10px solid #b32424}.mw-parser-output .ambox-content{border-left:10px solid #f28500}.mw-parser-output .ambox-style{border-left:10px solid #fc3}.mw-parser-output .ambox-move{border-left:10px solid #9932cc}.mw-parser-output .ambox-protection{border-left:10px solid #a2a9b1}.mw-parser-output .ambox .mbox-text{border:none;padding:0.25em 0.5em;width:100%}.mw-parser-output .ambox .mbox-image{border:none;padding:2px 0 2px 0.5em;text-align:center}.mw-parser-output .ambox .mbox-imageright{border:none;padding:2px 0.5em 2px 0;text-align:center}.mw-parser-output .ambox .mbox-empty-cell{border:none;padding:0;width:1px}.mw-parser-output .ambox .mbox-image-div{width:52px}@media(min-width:720px){.mw-parser-output .ambox{margin:0 10%}}@media print{body.ns-0 .mw-parser-output .ambox{display:none!important}}


/* end https://en.wikipedia.org/ */
</style>
<style data-mw-deduplicate="TemplateStyles:r1236090951">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">For other uses of "piecewise linear", see <a href="Piecewise_linear_(disambiguation)" class="mw-redirect mw-disambig" title="Piecewise linear (disambiguation)">Piecewise linear (disambiguation)</a>.</div>
<p>In <a href="Mathematics" title="Mathematics">mathematics</a>, a <b>piecewise linear</b> or <b>segmented function</b> is a <a href="Real-valued_function" title="Real-valued function">real-valued function</a> of a real variable, whose <a href="Graph_of_a_function" title="Graph of a function">graph</a> is composed of straight-<a href="Line_segment" title="Line segment">line segments</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Definition">Definition</h2></div>
<p>A piecewise linear function is a function defined on a (possibly unbounded) <a href="Interval_(mathematics)" title="Interval (mathematics)">interval</a> of <a href="Real_number" title="Real number">real numbers</a>, such that there is a collection of intervals on each of which the function is an <a href="Affine_transformation" title="Affine transformation">affine function</a>. (Thus "piecewise linear" is actually defined to mean "piecewise <a href="Affine_function" class="mw-redirect" title="Affine function">affine</a>".) If the domain of the function is <a href="Compact_space" title="Compact space">compact</a>, there needs to be a finite collection of such intervals; if the domain is not compact, it may either be required to be finite or to be <a href="Locally_finite_collection" title="Locally finite collection">locally finite</a> in the reals.
</p>
<div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div>

<p>The function defined by
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f(x)={\begin{cases}-x-3&amp;{\text{if }}x\leq -3\\x+3&amp;{\text{if }}-3<x<0\\-2x+3&amp;{\text{if }}0\leq x<3\\0.5x-4.5&amp;{\text{if }}x\geq 3\end{cases}}}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo stretchy="false">(</mo>
<mi>x</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow>
<mo>{</mo>
<mtable columnalign="left left" rowspacing=".2em" columnspacing="1em" displaystyle="false">
<mtr>
<mtd>
<mo>−<!-- − --></mo>
<mi>x</mi>
<mo>−<!-- − --></mo>
<mn>3</mn>
</mtd>
<mtd>
<mrow class="MJX-TeXAtom-ORD">
<mtext>if&nbsp;</mtext>
</mrow>
<mi>x</mi>
<mo>≤<!-- ≤ --></mo>
<mo>−<!-- − --></mo>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mi>x</mi>
<mo>+</mo>
<mn>3</mn>
</mtd>
<mtd>
<mrow class="MJX-TeXAtom-ORD">
<mtext>if&nbsp;</mtext>
</mrow>
<mo>−<!-- − --></mo>
<mn>3</mn>
<mo>&lt;</mo>
<mi>x</mi>
<mo>&lt;</mo>
<mn>0</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mo>−<!-- − --></mo>
<mn>2</mn>
<mi>x</mi>
<mo>+</mo>
<mn>3</mn>
</mtd>
<mtd>
<mrow class="MJX-TeXAtom-ORD">
<mtext>if&nbsp;</mtext>
</mrow>
<mn>0</mn>
<mo>≤<!-- ≤ --></mo>
<mi>x</mi>
<mo>&lt;</mo>
<mn>3</mn>
</mtd>
</mtr>
<mtr>
<mtd>
<mn>0.5</mn>
<mi>x</mi>
<mo>−<!-- − --></mo>
<mn>4.5</mn>
</mtd>
<mtd>
<mrow class="MJX-TeXAtom-ORD">
<mtext>if&nbsp;</mtext>
</mrow>
<mi>x</mi>
<mo>≥<!-- ≥ --></mo>
<mn>3</mn>
</mtd>
</mtr>
</mtable>
<mo fence="true" stretchy="true" symmetric="true"></mo>
</mrow>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f(x)={\begin{cases}-x-3&amp;{\text{if }}x\leq -3\\x+3&amp;{\text{if }}-3&lt;x&lt;0\\-2x+3&amp;{\text{if }}0\leq x&lt;3\\0.5x-4.5&amp;{\text{if }}x\geq 3\end{cases}}}</annotation>
</semantics>
</math></span><img src="./43921c78b9f0f950bbb30df61799eaf0dc742752.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -5.005ex; width:37.401ex; height:11.176ex;" alt="{\displaystyle f(x)={\begin{cases}-x-3&amp;{\text{if }}x\leq -3\\x+3&amp;{\text{if }}-3<x<0\\-2x+3&amp;{\text{if }}0\leq x<3\\0.5x-4.5&amp;{\text{if }}x\geq 3\end{cases}}}" loading="lazy"></span></dd></dl>
<p>is piecewise linear with four pieces. The graph of this function is shown to the right. Since the graph of an affine(*) function is a <a href="Line_(geometry)" title="Line (geometry)">line</a>, the graph of a piecewise linear function consists of <a href="Line_segment" title="Line segment">line segments</a> and <a href="Ray_(mathematics)" class="mw-redirect" title="Ray (mathematics)">rays</a>. The <i>x</i> values (in the above example −3, 0, and 3) where the slope changes are typically called breakpoints, changepoints, threshold values or knots. As in many applications, this function is also continuous. The graph of a continuous piecewise linear function on a compact interval is a <a href="Polygonal_chain" title="Polygonal chain">polygonal chain</a>.
</p><p>(*) A <a href="Linear_map" title="Linear map">linear function</a> satisfies by definition <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f(\lambda x)=\lambda f(x)}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo stretchy="false">(</mo>
<mi>λ<!-- λ --></mi>
<mi>x</mi>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mi>λ<!-- λ --></mi>
<mi>f</mi>
<mo stretchy="false">(</mo>
<mi>x</mi>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f(\lambda x)=\lambda f(x)}</annotation>
</semantics>
</math></span><img src="./29b42352460cf33e32f4eaed1b01856c9627a235.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:14.644ex; height:2.843ex;" alt="{\displaystyle f(\lambda x)=\lambda f(x)}" loading="lazy"></span> and therefore in particular <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f(0)=0}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo stretchy="false">(</mo>
<mn>0</mn>
<mo stretchy="false">)</mo>
<mo>=</mo>
<mn>0</mn>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f(0)=0}</annotation>
</semantics>
</math></span><img src="./8d308c32c9894b88115262081194321ae7d9bbf3.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:8.511ex; height:2.843ex;" alt="{\displaystyle f(0)=0}" loading="lazy"></span>; functions whose graph is a straight line are <i><a href="Affine_function" class="mw-redirect" title="Affine function">affine</a></i> rather than <i>linear</i>.
</p><p>There are other examples of piecewise linear functions:
</p>
<ul><li><a href="Absolute_value" title="Absolute value">Absolute value</a><sup id="cite_ref-:0_2-0" class="reference"><a href="#cite_note-:0-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Sawtooth_wave" title="Sawtooth wave">Sawtooth function</a></li>
<li><a href="Floor_function" class="mw-redirect" title="Floor function">Floor function</a></li>
<li><a href="Step_function" title="Step function">Step function</a>, a function composed of constant sub-functions, so also called a piecewise constant function
<ul><li><a href="Boxcar_function" title="Boxcar function">Boxcar function</a>,</li>
<li><a href="Heaviside_step_function" title="Heaviside step function">Heaviside step function</a><sup id="cite_ref-:0_2-1" class="reference"><a href="#cite_note-:0-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup></li>
<li><a href="Sign_function" title="Sign function">Sign function</a></li></ul></li>
<li><a href="Triangular_function" title="Triangular function">Triangular function</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Fitting_to_a_curve">Fitting to a curve</h2></div>

<p>An approximation to a known curve can be found by sampling the curve and interpolating linearly between the points. An algorithm for computing the most significant points subject to a given error tolerance has been published.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Fitting_to_data">Fitting to data</h2></div>
<div role="note" class="hatnote navigation-not-searchable">Main article: <a href="Segmented_regression" title="Segmented regression">Segmented regression</a></div>
<p>If partitions, and then breakpoints, are already known, <a href="Linear_regression" title="Linear regression">linear regression</a> can be performed independently on these partitions.
However, continuity is not preserved in that case, and also there is no unique reference model underlying the observed data. A stable algorithm with this case has been derived.<sup id="cite_ref-Golovchenko_4-0" class="reference"><a href="#cite_note-Golovchenko-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p><p>If partitions are not known, the <a href="Residual_sum_of_squares" title="Residual sum of squares">residual sum of squares</a> can be used to choose optimal separation points.<sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> However efficient computation and joint estimation of all model parameters (including the breakpoints) may be obtained by an iterative procedure<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup> currently implemented in the package <code>segmented</code><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup> for the <a href="R_(programming_language)" title="R (programming language)">R language</a>.
</p><p>A variant of <a href="Decision_tree_learning" title="Decision tree learning">decision tree learning</a> called model trees learns piecewise linear functions.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Generalizations">Generalizations</h2></div>

<p>The notion of a piecewise linear function makes sense in several different contexts. Piecewise linear functions may be defined on <a href="Dimension" title="Dimension"><i>n</i>-dimensional</a> <a href="Euclidean_space" title="Euclidean space">Euclidean space</a>, or more generally any <a href="Vector_space" title="Vector space">vector space</a> or <a href="Affine_space" title="Affine space">affine space</a>, as well as on <a href="Piecewise_linear_manifold" title="Piecewise linear manifold">piecewise linear manifolds</a> and <a href="Simplicial_complex" title="Simplicial complex">simplicial complexes</a> (see <a href="Simplicial_map" title="Simplicial map">simplicial map</a>). In each case, the function may be <a href="Real_number" title="Real number">real</a>-valued, or it may take values from a vector space, an affine space, a piecewise linear manifold, or a simplicial complex. (In these contexts, the term “linear” does not refer solely to <a href="Linear_map" title="Linear map">linear transformations</a>, but to more general <a href="Affine_transformation" title="Affine transformation">affine linear</a> functions.)
</p><p>In dimensions higher than one, it is common to require the domain of each piece to be a <a href="Polygon" title="Polygon">polygon</a> or <a href="Polytope" title="Polytope">polytope</a>. This guarantees that the graph of the function will be composed of polygonal or polytopal pieces.
</p><p><a href="Spline_(mathematics)" title="Spline (mathematics)">Splines</a> generalize piecewise linear functions to higher-order polynomials, which are in turn contained in the category of piecewise-differentiable functions, <a href="PDIFF" title="PDIFF">PDIFF</a>.
</p>
<div class="mw-heading mw-heading2"><h2 id="Specializations">Specializations</h2></div>
<p>Important sub-classes of piecewise linear functions include the <a href="Continuous_function" title="Continuous function">continuous</a> piecewise linear functions and the <a href="Convex_function" title="Convex function">convex</a> piecewise linear functions.
In general, for every <i>n</i>-dimensional continuous piecewise linear function <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} }">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo>:</mo>
<msup>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="double-struck">R</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
</mrow>
</msup>
<mo stretchy="false">→<!-- → --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="double-struck">R</mi>
</mrow>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} }</annotation>
</semantics>
</math></span><img src="./306c097f43c91dce633d12cde024948d39e73752.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:11.404ex; height:2.676ex;" alt="{\displaystyle f:\mathbb {R} ^{n}\to \mathbb {R} }" loading="lazy"></span>, there is a
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Pi \in {\mathcal {P}}({\mathcal {P}}(\mathbb {R} ^{n+1}))}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Π<!-- Π --></mi>
<mo>∈<!-- ∈ --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">P</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">P</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<msup>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="double-struck">R</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msup>
<mo stretchy="false">)</mo>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Pi \in {\mathcal {P}}({\mathcal {P}}(\mathbb {R} ^{n+1}))}</annotation>
</semantics>
</math></span><img src="./1a578274c23d51e7a9482964c7dc6b813aaa8599.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:16.607ex; height:3.176ex;" alt="{\displaystyle \Pi \in {\mathcal {P}}({\mathcal {P}}(\mathbb {R} ^{n+1}))}" loading="lazy"></span></dd></dl>
<p>such that
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f({\vec {x}})=\min _{\Sigma \in \Pi }\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>x</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo stretchy="false">)</mo>
<mo>=</mo>
<munder>
<mo movablelimits="true" form="prefix">min</mo>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="normal">Σ<!-- Σ --></mi>
<mo>∈<!-- ∈ --></mo>
<mi mathvariant="normal">Π<!-- Π --></mi>
</mrow>
</munder>
<munder>
<mo movablelimits="true" form="prefix">max</mo>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>a</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>,</mo>
<mi>b</mi>
<mo stretchy="false">)</mo>
<mo>∈<!-- ∈ --></mo>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
</mrow>
</munder>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>a</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>⋅<!-- ⋅ --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>x</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>+</mo>
<mi>b</mi>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f({\vec {x}})=\min _{\Sigma \in \Pi }\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}</annotation>
</semantics>
</math></span><img src="./f493495ed6c074e96f1d88e14049254e00a5bfe2.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.838ex; width:26.483ex; height:4.843ex;" alt="{\displaystyle f({\vec {x}})=\min _{\Sigma \in \Pi }\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}" loading="lazy"></span><sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup></dd></dl>
<p>If <span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f}</annotation>
</semantics>
</math></span><img src="./132e57acb643253e7810ee9702d9581f159a1c61.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.671ex; width:1.279ex; height:2.509ex;" alt="{\displaystyle f}" loading="lazy"></span> is convex and continuous, then there is a
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle \Sigma \in {\mathcal {P}}(\mathbb {R} ^{n+1})}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi mathvariant="normal">Σ<!-- Σ --></mi>
<mo>∈<!-- ∈ --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mi class="MJX-tex-caligraphic" mathvariant="script">P</mi>
</mrow>
</mrow>
<mo stretchy="false">(</mo>
<msup>
<mrow class="MJX-TeXAtom-ORD">
<mi mathvariant="double-struck">R</mi>
</mrow>
<mrow class="MJX-TeXAtom-ORD">
<mi>n</mi>
<mo>+</mo>
<mn>1</mn>
</mrow>
</msup>
<mo stretchy="false">)</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle \Sigma \in {\mathcal {P}}(\mathbb {R} ^{n+1})}</annotation>
</semantics>
</math></span><img src="./52043b3143dad1a5eec0f4a66de44f871c7e05a5.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -0.838ex; width:13.029ex; height:3.176ex;" alt="{\displaystyle \Sigma \in {\mathcal {P}}(\mathbb {R} ^{n+1})}" loading="lazy"></span></dd></dl>
<p>such that
</p>
<dl><dd><span class="mwe-math-element mwe-math-element-inline"><span class="mwe-math-mathml-inline mwe-math-mathml-a11y" style="display: none;"><math xmlns="http://www.w3.org/1998/Math/MathML" alttext="{\displaystyle f({\vec {x}})=\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}">
<semantics>
<mrow class="MJX-TeXAtom-ORD">
<mstyle displaystyle="true" scriptlevel="0">
<mi>f</mi>
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>x</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo stretchy="false">)</mo>
<mo>=</mo>
<munder>
<mo movablelimits="true" form="prefix">max</mo>
<mrow class="MJX-TeXAtom-ORD">
<mo stretchy="false">(</mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>a</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>,</mo>
<mi>b</mi>
<mo stretchy="false">)</mo>
<mo>∈<!-- ∈ --></mo>
<mi mathvariant="normal">Σ<!-- Σ --></mi>
</mrow>
</munder>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>a</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>⋅<!-- ⋅ --></mo>
<mrow class="MJX-TeXAtom-ORD">
<mrow class="MJX-TeXAtom-ORD">
<mover>
<mi>x</mi>
<mo stretchy="false">→<!-- → --></mo>
</mover>
</mrow>
</mrow>
<mo>+</mo>
<mi>b</mi>
<mo>.</mo>
</mstyle>
</mrow>
<annotation encoding="application/x-tex">{\displaystyle f({\vec {x}})=\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}</annotation>
</semantics>
</math></span><img src="./a966b48598520540914d6cdb57ba577fa52505ea.svg" class="mwe-math-fallback-image-inline mw-invert skin-invert" aria-hidden="true" style="vertical-align: -2.838ex; width:22.221ex; height:4.843ex;" alt="{\displaystyle f({\vec {x}})=\max _{({\vec {a}},b)\in \Sigma }{\vec {a}}\cdot {\vec {x}}+b.}" loading="lazy"></span></dd></dl>
<div class="mw-heading mw-heading2"><h2 id="Applications">Applications</h2></div>


<p>In <a href="Agriculture" title="Agriculture">agriculture</a> piecewise <a href="Regression_analysis" title="Regression analysis">regression analysis</a> of measured data is used to detect the range over which growth factors affect the yield and the range over which the crop is not sensitive to changes in these factors.
</p><p>The image on the left shows that at shallow <a href="Watertable" class="mw-redirect" title="Watertable">watertables</a> the yield declines, whereas at deeper (&gt; 7 dm) watertables the yield is unaffected. The graph is made using the method of <a href="Least_squares" title="Least squares">least squares</a> to find the two segments with the <a href="Best_fit" class="mw-redirect" title="Best fit">best fit</a>.
</p><p>The graph on the right reveals that crop yields <a href="Salt_tolerance_of_crops" title="Salt tolerance of crops">tolerate</a> a <a href="Soil_salinity" title="Soil salinity">soil salinity</a> up to ECe = 8 dS/m (ECe is the electric conductivity of an extract of a saturated soil sample), while beyond that value the crop production reduces. The graph is made with the method of partial regression to find the longest range of "no effect", i.e. where the line is horizontal. The two segments need not join at the same point. Only for the second segment method of least squares is used.
</p>
<div style="clear:both;" class=""></div>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Linear_interpolation" title="Linear interpolation">Linear interpolation</a></li>
<li><a href="Spline_interpolation" title="Spline interpolation">Spline interpolation</a></li>
<li><a href="Tropical_geometry" title="Tropical geometry">Tropical geometry</a></li>
<li><a href="Polygonal_chain" title="Polygonal chain">Polygonal chain</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Further_reading">Further reading</h2></div>
<ul><li>Apps, P., Long, N., &amp; Rees, R. (2014). <a rel="nofollow" class="external text" href="http://onlinelibrary.wiley.com/doi/10.1111/jpet.12070/full">Optimal piecewise linear income taxation</a>. <i>Journal of Public Economic Theory</i>, <b>16</b>(4), 523–545.</li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap mw-references-columns"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFStanley2004" class="citation book cs1">Stanley, William D. (2004). <i>Technical Analysis And Applications With Matlab</i>. Cengage Learning. p.&nbsp;143. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>978-1401864811</bdi>.</cite></span>
</li>
<li id="cite_note-:0-2"><span class="mw-cite-backlink">^ <a href="#cite_ref-:0_2-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-:0_2-1"><sup><i><b>b</b></i></sup></a></span> <span class="reference-text"><cite id="CITEREFWeisstein" class="citation web cs1">Weisstein, Eric W. <a rel="nofollow" class="external text" href="https://mathworld.wolfram.com/PiecewiseFunction.html">"Piecewise Function"</a>. <i>mathworld.wolfram.com</i><span class="reference-accessdate">. Retrieved <span class="nowrap">2020-08-24</span></span>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite id="CITEREFHamannChen1994" class="citation journal cs1">Hamann, B.; Chen, J. L. (1994). <a rel="nofollow" class="external text" href="https://escholarship.org/content/qt6p65k0mr/qt6p65k0mr.pdf?t=ptt2jz">"Data point selection for piecewise linear curve approximation"</a> <span class="cs1-format">(PDF)</span>. <i>Computer Aided Geometric Design</i>. <b>11</b> (3): 289. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1016%2F0167-8396%2894%2990004-3">10.1016/0167-8396(94)90004-3</a>.</cite></span>
</li>
<li id="cite_note-Golovchenko-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-Golovchenko_4-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFGolovchenko" class="citation web cs1">Golovchenko, Nikolai. <a rel="nofollow" class="external text" href="https://drive.google.com/file/d/1M5b5EoGbARlcsRVnG-7D64cpL8Vh76Av/view?usp=sharing">"Least-squares Fit of a Continuous Piecewise Linear Function"</a><span class="reference-accessdate">. Retrieved <span class="nowrap">6 Dec</span> 2012</span>.</cite></span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text"><cite id="CITEREFVieth1989" class="citation journal cs1">Vieth, E. (1989). "Fitting piecewise linear regression functions to biological responses". <i>Journal of Applied Physiology</i>. <b>67</b> (1): <span class="nowrap">390–</span>396. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1152%2Fjappl.1989.67.1.390">10.1152/jappl.1989.67.1.390</a>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a>&nbsp;<a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/2759968">2759968</a>.</cite></span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><cite id="CITEREFMuggeo2003" class="citation journal cs1">Muggeo, V. M. R. (2003). "Estimating regression models with unknown break-points". <i>Statistics in Medicine</i>. <b>22</b> (19): <span class="nowrap">3055–</span>3071. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<a rel="nofollow" class="external text" href="https://doi.org/10.1002%2Fsim.1545">10.1002/sim.1545</a>. <a href="PMID_(identifier)" class="mw-redirect" title="PMID (identifier)">PMID</a>&nbsp;<a rel="nofollow" class="external text" href="https://pubmed.ncbi.nlm.nih.gov/12973787">12973787</a>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&nbsp;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:36264047">36264047</a>.</cite></span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text"><cite id="CITEREFMuggeo2008" class="citation web cs1">Muggeo, V. M. R. (2008). <a rel="nofollow" class="external text" href="ftp://200.236.31.12/CRAN/doc/Rnews/Rnews_2008-1.pdf#page=20">"Segmented: an R package to fit regression models with broken-line relationships"</a> <span class="cs1-format">(PDF)</span>. <i>R News</i> (<a href="FTP" class="mw-redirect" title="FTP">FTP</a>). pp.&nbsp;<span class="nowrap">20–</span>25.</cite> <span style="font-size:0.95em; font-size:95%; color: var( --color-subtle, #555 )">(To view documents see Help:FTP)</span></span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite id="CITEREFLandwehrHallFrank2005" class="citation journal cs1">Landwehr, N.; Hall, M.; Frank, E. (2005). <a rel="nofollow" class="external text" href="http://www.cs.waikato.ac.nz/~eibe/pubs/LMT.pdf">"Logistic Model Trees"</a> <span class="cs1-format">(PDF)</span>. <i>Machine Learning</i>. <b>59</b> (<span class="nowrap">1–</span>2): <span class="nowrap">161–</span>205. <a href="Doi_(identifier)" class="mw-redirect" title="Doi (identifier)">doi</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://doi.org/10.1007%2Fs10994-005-0466-3">10.1007/s10994-005-0466-3</a></span>. <a href="S2CID_(identifier)" class="mw-redirect" title="S2CID (identifier)">S2CID</a>&nbsp;<a rel="nofollow" class="external text" href="https://api.semanticscholar.org/CorpusID:6306536">6306536</a>.</cite></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite id="CITEREFOvchinnikov2002" class="citation journal cs1">Ovchinnikov, Sergei (2002). "Max-min representation of piecewise linear functions". <i>Beiträge zur Algebra und Geometrie</i>. <b>43</b> (1): <span class="nowrap">297–</span>302. <a href="ArXiv_(identifier)" class="mw-redirect" title="ArXiv (identifier)">arXiv</a>:<span class="id-lock-free" title="Freely accessible"><a rel="nofollow" class="external text" href="https://arxiv.org/abs/math/0009026">math/0009026</a></span>. <a href="MR_(identifier)" class="mw-redirect" title="MR (identifier)">MR</a>&nbsp;<a rel="nofollow" class="external text" href="https://mathscinet.ams.org/mathscinet-getitem?mr=1913786">1913786</a>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://www.waterlog.info/segreg.htm">A calculator for piecewise regression</a>.</span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><a rel="nofollow" class="external text" href="https://www.waterlog.info/partreg.htm">A calculator for partial regression</a>.</span>
</li>
</ol></div></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-27" href="https://en.wikipedia.org/wiki/?title=Piecewise_linear_function&amp;oldid=1292516852">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>